local skel = fk.CreateSkill {
  name = "rmt__xingjiang",
}

skel:addEffect("active", {
  min_card_num = 2,
  target_num = 0,
  prompt = "#rmt__xingjiang",
  card_filter = function (self, player, to_select, selected)
    local c = Fk:getCardById(to_select)
    return (c.type == Card.TypeBasic or c:isCommonTrick()) and table.every(selected, function (id)
      return Fk:getCardById(id).name == c.name
    end)
  end,
  can_use = function(self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0
  end,
  times = function (self, player)
    return 1 - player:usedSkillTimes(skel.name, Player.HistoryPhase)
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local name = Fk:getCardById(effect.cards[1]).name
    room:throwCard(effect.cards, skel.name, player, player)
    if player.dead then return end
    local skillName = "rmt__xingjiang_"..name
    if Fk.skills[skillName] == nil then
      for i = 1, 30 do
        local s = Fk.skills["rmt__xingjiang_"..i]
        if s and not player:hasSkill(s, true) then
          skillName = s.name
          room:setPlayerMark(player, s.name, name)
          break
        end
      end
    end
    if Fk.skills[skillName] ~= nil then
      room:handleAddLoseSkills(player, skillName)
    end
  end,
})

Fk:loadTranslationTable{
  ["rmt__xingjiang"] = "行将",
  [":rmt__xingjiang"] = "出牌阶段限一次，你可以弃置至少两张同名基本或普通锦囊牌，获得一个“每轮一次，你可以视为使用此牌”的技能。（每牌名限获得一个）",

  ["#rmt__xingjiang"] = "你可弃置至少两张同名基本牌或普通锦囊牌，转化为每轮限一次的技能",

  ["$rmt__xingjiang1"] = "寡人不德，忝荷戎重，经营旧邑，瞻望华夏。",
  ["$rmt__xingjiang2"] = "据河洛，襟秦赵，远不五载，大事必定。",
  ["$rmt__xingjiang3"] = "任大者思远，思远者忘近。",
  ["$rmt__xingjiang4"] = "制五兵之利 ，为万国之资。",
}

return skel
